<template>
	<sc-table-select
		v-model="value"
		:apiObj="this.$API.mditem.pageByKeyword"
		:props="{
            label: 'itemName',
            value: 'id',
        }"
		@change="change">
		<template #header="{form, submit}">
			<el-form :inline="true" :model="form">
				<el-form-item>
					<el-input el-select v-model.trim="form.key" placeholder="输入物料编码或名称查询" />
				</el-form-item>
				<el-form-item>
					<el-button type="primary" @click="submit">查询</el-button>
				</el-form-item>
			</el-form>
		</template>

		<el-table-column prop="itemCode" label="物料编号" width="100"></el-table-column>
		<el-table-column prop="itemName" label="物料名称" width="160"></el-table-column>
		<el-table-column prop="classify" label="物料分类">
			<template #default="scope">
				<el-tag v-if="scope.row.classify == 1" :type="''" effect="dark">{{ scope.row.classifyDesc }}</el-tag>
				<el-tag
					v-if="scope.row.classify == 2"
					:type="'success'"
					effect="dark"
					>{{ scope.row.classifyDesc }}</el-tag
				>
				<el-tag
					v-if="scope.row.classify == 3"
					:type="'info'"
					effect="dark"
					>{{ scope.row.classifyDesc }}</el-tag
				>
			</template>
		</el-table-column>
	</sc-table-select>
</template>

<script>
export default {
    emits: ['change'],
    data() {
        return {
            value: [],
        }
    },
    methods: {
        change (row) {
            this.$emit("change", row);
        }
    },
}
</script>
